const { app, BrowserWindow } = require('electron');
const path = require('path');
const fs = require('fs');
const backendService = require('./backendService');

let mainWindow;

// 创建日志目录
const logDir = path.join(app.getPath('userData'), 'logs');
if (!fs.existsSync(logDir)) {
    fs.mkdirSync(logDir, { recursive: true });
}

// 创建日志文件
const logFile = path.join(logDir, 'app.log');
const log = (message) => {
    const timestamp = new Date().toISOString();
    const logMessage = `${timestamp}: ${message}\n`;
    fs.appendFileSync(logFile, logMessage);
};

module.exports = log;